﻿using PureMVC.Interfaces;
using System;

namespace PureMVC.Patterns.Observer
{
    public class Observer : IObserver
    {
        public Observer(Action<INotification> _notifyMethod, object _notifyContext)
        {
            NotifyMethod = _notifyMethod;
            NotifyContext = _notifyContext;
        }

        public bool CompareNotifyContext(object _obj)
        {
            return NotifyContext.Equals(_obj);
        }

        public void NotifyObserver(INotification _notification)
        {
            NotifyMethod(_notification);
        }

        public Action<INotification> NotifyMethod { get; set; }
        public object NotifyContext { get; set; }
    }
}